% Return the imaging configuration
%
% CONFIG = GetImgConfig(location): Return the imaging configuration CONFIG
%  of the hdf5 in the input LOCATION  (string).
% you can  also provide the  CONF_REF given by:
% 1 -> Imaging without microscope
% 2 -> Imaging with microscope X4
% 3 -> Imaging with microscope X10
%
% T. Vanderbruggen, 2013
% mod. S. Palacios, 2014

function config = GetImgConfig(location)
if ~isscalar(location)
    hdfFilePath = [location '/run_0.h5'];
    conf_ref =  h5read(hdfFilePath , '/Image/configuration');
else
    conf_ref = location;
end

switch conf_ref
    case 1
        config.obj   = 'Xenonplan1:2';
        config.micro = 'None';
        config.cam   = 'pco.pixelfly';
    case 2
        config.obj   = 'Xenonplan1:2';
        config.micro = 'N4X-PF';
        config.cam   = 'pco.pixelfly';
    case 3
        config.obj   = 'Xenonplan1:2';
        config.micro = 'N10X-PF';
        config.cam   = 'pco.pixelfly';
    otherwise
        error('Unknown imaging configuration reference');
end

config.binning = 1;

end